﻿<Window x:Class="SBPweb.Presentation.WpfTestApp1.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:SBPwebControls="clr-namespace:SBPweb.Presentation.CompleteMesh.Controls;assembly=SBPweb.Presentation.CompleteMesh"
    xmlns:SBPwebPrimitives="clr-namespace:SBPweb.Presentation.CompleteMesh.Primitives;assembly=SBPweb.Presentation.CompleteMesh"
    Title="Main window"
    Width="800"
    Height="600"
    Background="#000000">
    <SBPwebControls:ViewPort
        x:Name="vpMain"
        Width="778"
        Height="562">

        <SBPwebControls:ViewPort.Resources>
            <SBPwebPrimitives:SphereMesh
                        x:Key="SphereMeshSource1"
                        Radius="20"
                        Separators="10" />
            <SBPwebPrimitives:CubeMesh
                        x:Key="CubeMeshSource1"
                        Width="40" />
            <MeshGeometry3D
                        x:Key="SphereMesh1"
                        Positions="{Binding Source={StaticResource SphereMeshSource1}, Path=Positions}"
                        TriangleIndices="{Binding Source={StaticResource SphereMeshSource1}, Path=TriangleIndices}"
                        Normals="{Binding Source={StaticResource SphereMeshSource1}, Path=Normals}"
                        TextureCoordinates="{Binding Source={StaticResource SphereMeshSource1}, Path=TextureCoordinates}"/>
            <MeshGeometry3D
                        x:Key="SphereMesh2"
                        Positions="{Binding Source={StaticResource SphereMeshSource1}, Path=Positions}"
                        TriangleIndices="{Binding Source={StaticResource SphereMeshSource1}, Path=TriangleIndices}"
                        Normals="{Binding Source={StaticResource SphereMeshSource1}, Path=Normals}"
                        TextureCoordinates="{Binding Source={StaticResource SphereMeshSource1}, Path=TextureCoordinates}"/>
            <MeshGeometry3D
                        x:Key="CubeMesh1"
                        Positions="{Binding Source={StaticResource CubeMeshSource1}, Path=Positions}"
                        TriangleIndices="{Binding Source={StaticResource CubeMeshSource1}, Path=TriangleIndices}"
                        Normals="{Binding Source={StaticResource CubeMeshSource1}, Path=Normals}"
                        TextureCoordinates="{Binding Source={StaticResource CubeMeshSource1}, Path=TextureCoordinates}"/>
        </SBPwebControls:ViewPort.Resources>

        <SBPwebControls:ViewPort.MainChildrenModel>

            <ModelVisual3D>

                <!--SBPwebPrimitives:Sphere3D>

                    <SBPwebPrimitives:Sphere3D.Transform>
                    
                        <TranslateTransform3D OffsetX="2" OffsetY="0" OffsetZ="0" />
                        
                    </SBPwebPrimitives:Sphere3D.Transform>

                    <SBPwebPrimitives:Sphere3D.Material>

                        <DiffuseMaterial Brush="Red" />

                    </SBPwebPrimitives:Sphere3D.Material>

                </SBPwebPrimitives:Sphere3D-->

            </ModelVisual3D>

        </SBPwebControls:ViewPort.MainChildrenModel>

        <SBPwebControls:ViewPort.MainContentModelGroup>

            <Model3DGroup>

                <DirectionalLight
                            Color="#FFFFFF" 
                            Direction="0 +30 0" />

                <DirectionalLight
                            Color="#888888" 
                            Direction="0 -30 0" />

                <GeometryModel3D
                            Geometry="{StaticResource SphereMesh1}">

                    <GeometryModel3D.Material>
                        <MaterialGroup>
                            <SpecularMaterial Brush="#FFFFFF" />
                            <DiffuseMaterial>
                                <DiffuseMaterial.Brush>
                                    <ImageBrush
                                                ImageSource="/SBPweb.Presentation.WpfTestApp1;component/Resources/Image1.png"
                                                Opacity="1.0"
                                                TileMode="None"
                                                Stretch="None"
                                                AlignmentX="Left"
                                                AlignmentY="Top" />
                                </DiffuseMaterial.Brush>
                            </DiffuseMaterial>
                        </MaterialGroup>
                    </GeometryModel3D.Material>
                    <GeometryModel3D.Transform>
                        <Transform3DGroup>
                            <TranslateTransform3D 
                                        OffsetX="-50"
                                    />
                        </Transform3DGroup>
                    </GeometryModel3D.Transform>
                </GeometryModel3D>

                <GeometryModel3D
                            Geometry="{StaticResource SphereMesh2}" >
                    <GeometryModel3D.Material>
                        <MaterialGroup>
                            <SpecularMaterial Brush="#FFFFFF" />
                            <DiffuseMaterial Brush="#00FF00" />
                        </MaterialGroup>
                    </GeometryModel3D.Material>
                    <GeometryModel3D.Transform>
                        <Transform3DGroup>
                            <ScaleTransform3D
                                        ScaleX="0.5"
                                        ScaleY="0.5"
                                        ScaleZ="0.5"
                                    />
                            <TranslateTransform3D 
                                        OffsetX="50"
                                    />
                        </Transform3DGroup>
                    </GeometryModel3D.Transform>
                </GeometryModel3D>

                <GeometryModel3D
                            Geometry="{StaticResource CubeMesh1}">
                    <GeometryModel3D.Material>
                        <MaterialGroup>
                            <SpecularMaterial Brush="#FFFFFF" />
                            <DiffuseMaterial>
                                <DiffuseMaterial.Brush>
                                    <ImageBrush
                                        ImageSource="/SBPweb.Presentation.WpfTestApp1;component/Resources/Image1.png"
                                        Opacity="1.0"
                                        TileMode="None"
                                        Stretch="None"
                                        AlignmentX="Left"
                                        AlignmentY="Top" />
                                </DiffuseMaterial.Brush>
                            </DiffuseMaterial>
                        </MaterialGroup>
                    </GeometryModel3D.Material>
                </GeometryModel3D>


            </Model3DGroup>

        </SBPwebControls:ViewPort.MainContentModelGroup>

    </SBPwebControls:ViewPort>
</Window>
